home *** CD-ROM | disk | FTP | other *** search
/ This Disc Bytes! / Power Computing - The Disc 2 - This Disc Bytes.ISO / mac / CodeWarrior 7 Lite for 68K / MacOS Support / Headers / Universal Headers / MoviesFormat.h < prev    next >
Text File  |  1995-07-06  |  15KB  |  548 lines

  1. /*
  2.      File:        MoviesFormat.h
  3.  
  4.      Contains:    QuickTime Interfaces.
  5.  
  6.      Version:    Technology:    QuickTime 2.0
  7.                  Package:    Universal Interfaces 2.1 in “MPW Latest” on ETO #18
  8.  
  9.      Copyright:    © 1984-1995 by Apple Computer, Inc.
  10.                  All rights reserved.
  11.  
  12.      Bugs?:        If you find a problem with this file, use the Apple Bug Reporter
  13.                  stack.  Include the file and version information (from above)
  14.                  in the problem description and send to:
  15.                      Internet:    apple.bugs@applelink.apple.com
  16.                      AppleLink:    APPLE.BUGS
  17.  
  18. */
  19.  
  20. #ifndef __MOVIESFORMAT__
  21. #define __MOVIESFORMAT__
  22.  
  23.  
  24. #ifndef __TYPES__
  25. #include <Types.h>
  26. #endif
  27. /*    #include <ConditionalMacros.h>                                */
  28.  
  29. #ifndef __WINDOWS__
  30. #include <Windows.h>
  31. #endif
  32. /*    #include <Memory.h>                                            */
  33. /*        #include <MixedMode.h>                                    */
  34. /*    #include <Quickdraw.h>                                        */
  35. /*        #include <QuickdrawText.h>                                */
  36. /*    #include <Events.h>                                            */
  37. /*        #include <OSUtils.h>                                    */
  38. /*    #include <Controls.h>                                        */
  39. /*        #include <Menus.h>                                        */
  40.  
  41. #ifndef __IMAGECOMPRESSION__
  42. #include <ImageCompression.h>
  43. #endif
  44. /*    #include <QDOffscreen.h>                                    */
  45. /*        #include <Errors.h>                                        */
  46. /*    #include <Components.h>                                        */
  47. /*    #include <StandardFile.h>                                    */
  48. /*        #include <Dialogs.h>                                    */
  49. /*            #include <TextEdit.h>                                */
  50. /*        #include <Files.h>                                        */
  51. /*            #include <Finder.h>                                    */
  52.  
  53. #ifndef __MOVIES__
  54. #include <Movies.h>
  55. #endif
  56. /*    #include <Aliases.h>                                        */
  57. /*        #include <AppleTalk.h>                                    */
  58.  
  59. #ifdef __cplusplus
  60. extern "C" {
  61. #endif
  62.  
  63. #if PRAGMA_ALIGN_SUPPORTED
  64. #pragma options align=mac68k
  65. #endif
  66.  
  67. #if PRAGMA_IMPORT_SUPPORTED
  68. #pragma import on
  69. #endif
  70.  
  71.  
  72. enum {
  73.     kMovieVersion                = 0                                /* version number of the format here described */
  74. };
  75.  
  76. struct MoviesUserData {
  77.     long                            size;                        /* size of this user data */
  78.     long                            udType;                        /* type of user data */
  79.     char                            data[1];                    /* the user data */
  80. };
  81. typedef struct MoviesUserData MoviesUserData;
  82.  
  83. struct UserDataAtom {
  84.     long                            size;
  85.     long                            atomType;
  86.     MoviesUserData                    userData[1];
  87. };
  88. typedef struct UserDataAtom UserDataAtom;
  89.  
  90. /* MoviesDataDescription tells us where the data for the movie or track lives.
  91.    The data can follow the directory, be in the datafork of the same file as the directory resource,
  92.    be in the resource fork of the same file as the directory resource, be in another file in the
  93.    data fork or resource fork, or require a specific bottleneck to fetch the data. */
  94. /****************************************
  95. *
  96. *   MediaDirectory information -
  97. *        The MediaDirectory is tightly coupled to the data.
  98. *
  99. ****************************************/
  100. struct SampleDescriptionAtom {
  101.     long                            size;
  102.     long                            atomType;                    /* = 'stsd' */
  103.     long                            flags;                        /* 1 byte of version / 3 bytes of flags */
  104.     long                            numEntries;
  105.     SampleDescription                sampleDescTable[1];
  106. };
  107. typedef struct SampleDescriptionAtom SampleDescriptionAtom;
  108.  
  109. /* TimeToSampleNum maps physical sample time to physical sample number. */
  110. struct TimeToSampleNum {
  111.     long                            sampleCount;
  112.     TimeValue                        sampleDuration;
  113. };
  114. typedef struct TimeToSampleNum TimeToSampleNum;
  115.  
  116. struct TimeToSampleNumAtom {
  117.     long                            size;
  118.     long                            atomType;                    /* = 'stts' */
  119.     long                            flags;                        /* 1 byte of version / 3 bytes of flags */
  120.     long                            numEntries;
  121.     TimeToSampleNum                    timeToSampleNumTable[1];
  122. };
  123. typedef struct TimeToSampleNumAtom TimeToSampleNumAtom;
  124.  
  125. /* SyncSamples is a list of the physical samples which are self contained. */
  126. struct SyncSampleAtom {
  127.     long                            size;
  128.     long                            atomType;                    /* = 'stss' */
  129.     long                            flags;                        /* 1 byte of version / 3 bytes of flags */
  130.     long                            numEntries;
  131.     long                            syncSampleTable[1];
  132. };
  133. typedef struct SyncSampleAtom SyncSampleAtom;
  134.  
  135. /* SampleToChunk maps physical sample number to chunk number. */
  136. /* same as SampleToChunk, but redundant first sample is removed */
  137. struct SampleToChunk {
  138.     long                            firstChunk;
  139.     long                            samplesPerChunk;
  140.     long                            sampleDescriptionID;
  141. };
  142. typedef struct SampleToChunk SampleToChunk;
  143.  
  144. struct SampleToChunkAtom {
  145.     long                            size;
  146.     long                            atomType;                    /* = 'stsc' */
  147.     long                            flags;                        /* 1 byte of version / 3 bytes of flags */
  148.     long                            numEntries;
  149.     SampleToChunk                    sampleToChunkTable[1];
  150. };
  151. typedef struct SampleToChunkAtom SampleToChunkAtom;
  152.  
  153. struct ChunkOffsetAtom {
  154.     long                            size;
  155.     long                            atomType;                    /* = 'stco' */
  156.     long                            flags;                        /* 1 byte of version / 3 bytes of flags */
  157.     long                            numEntries;
  158.     long                            chunkOffsetTable[1];
  159. };
  160. typedef struct ChunkOffsetAtom ChunkOffsetAtom;
  161.  
  162. struct SampleSizeAtom {
  163.     long                            size;
  164.     long                            atomType;                    /* = 'stsz' */
  165.     long                            flags;                        /* 1 byte of version / 3 bytes of flags */
  166.     long                            sampleSize;
  167.     long                            numEntries;
  168.     long                            sampleSizeTable[1];
  169. };
  170. typedef struct SampleSizeAtom SampleSizeAtom;
  171.  
  172. struct ShadowSync {
  173.     long                            fdSampleNum;
  174.     long                            syncSampleNum;
  175. };
  176. typedef struct ShadowSync ShadowSync;
  177.  
  178. struct ShadowSyncAtom {
  179.     long                            size;
  180.     long                            atomType;                    /* = 'stsz' */
  181.     long                            flags;                        /* 1 byte of version / 3 bytes of flags */
  182.     long                            numEntries;
  183.     ShadowSync                        shadowSyncTable[1];
  184. };
  185. typedef struct ShadowSyncAtom ShadowSyncAtom;
  186.  
  187. struct SampleTableAtom {
  188.     long                            size;
  189.     long                            atomType;                    /* = 'stbl' */
  190.     SampleDescriptionAtom            sampleDescription;
  191.     TimeToSampleNumAtom                timeToSampleNum;
  192.     SampleToChunkAtom                sampleToChunk;
  193.     SyncSampleAtom                    syncSample;
  194.     SampleSizeAtom                    sampleSize;
  195.     ChunkOffsetAtom                    chunkOffset;
  196.     ShadowSyncAtom                    shadowSync;
  197. };
  198. typedef struct SampleTableAtom SampleTableAtom;
  199.  
  200. struct PublicHandlerInfo {
  201.     long                            flags;                        /* 1 byte of version / 3 bytes of flags */
  202.     long                            componentType;
  203.     long                            componentSubType;
  204.     long                            componentManufacturer;
  205.     long                            componentFlags;
  206.     long                            componentFlagsMask;
  207.     char                            componentName[1];
  208. };
  209. typedef struct PublicHandlerInfo PublicHandlerInfo;
  210.  
  211. struct HandlerAtom {
  212.     long                            size;
  213.     long                            atomType;                    /* = 'hdlr' */
  214.     PublicHandlerInfo                hInfo;
  215. };
  216. typedef struct HandlerAtom HandlerAtom;
  217.  
  218. /* a data reference is a private structure */
  219. typedef long DataRefAtom;
  220.  
  221. struct DataInfoAtom {
  222.     long                            size;
  223.     long                            atomType;                    /* = 'dinf' */
  224.     DataRefAtom                        dataRef;
  225. };
  226. typedef struct DataInfoAtom DataInfoAtom;
  227.  
  228. struct RgnAtom {
  229.     long                            size;
  230.     long                            atomType;
  231.     short                            rgnSize;
  232.     Rect                            rgnBBox;
  233.     char                            data[1];
  234. };
  235. typedef struct RgnAtom RgnAtom;
  236.  
  237. struct MatteCompressedAtom {
  238.     long                            size;
  239.     long                            atomType;
  240.     long                            flags;                        /* 1 byte of version / 3 bytes of flags */
  241.     ImageDescription                matteImageDescription;
  242.     char                            matteData[1];
  243. };
  244. typedef struct MatteCompressedAtom MatteCompressedAtom;
  245.  
  246. struct MatteAtom {
  247.     long                            size;
  248.     long                            atomType;
  249.     MatteCompressedAtom                aCompressedMatte;
  250. };
  251. typedef struct MatteAtom MatteAtom;
  252.  
  253. struct ClippingAtom {
  254.     long                            size;
  255.     long                            atomType;
  256.     RgnAtom                            aRgnClip;
  257. };
  258. typedef struct ClippingAtom ClippingAtom;
  259.  
  260. /***********************
  261. * Media Info Example Structures
  262. ***********************/
  263. struct VideoMediaInfoHeader {
  264.     long                            flags;                        /* 1 byte of version / 3 bytes of flags */
  265.     short                            graphicsMode;                /* for QD - transfer mode */
  266.     short                            opColorRed;                    /* opcolor for transfer mode */
  267.     short                            opColorGreen;
  268.     short                            opColorBlue;
  269. };
  270. typedef struct VideoMediaInfoHeader VideoMediaInfoHeader;
  271.  
  272. struct VideoMediaInfoHeaderAtom {
  273.     long                            size;                        /* size of Media info */
  274.     long                            atomType;                    /* = 'vmhd' */
  275.     VideoMediaInfoHeader            vmiHeader;
  276. };
  277. typedef struct VideoMediaInfoHeaderAtom VideoMediaInfoHeaderAtom;
  278.  
  279. struct VideoMediaInfo {
  280.     long                            size;                        /* size of Media info */
  281.     long                            atomType;                    /* = 'minf' */
  282.     VideoMediaInfoHeaderAtom        header;
  283.     HandlerAtom                        dataHandler;
  284.     DataInfoAtom                    dataInfo;
  285.     SampleTableAtom                    sampleTable;
  286. };
  287. typedef struct VideoMediaInfo VideoMediaInfo;
  288.  
  289. struct SoundMediaInfoHeader {
  290.     long                            flags;                        /* 1 byte of version / 3 bytes of flags */
  291.     short                            balance;
  292.     short                            rsrvd;
  293. };
  294. typedef struct SoundMediaInfoHeader SoundMediaInfoHeader;
  295.  
  296. struct SoundMediaInfoHeaderAtom {
  297.     long                            size;                        /* size of Media info */
  298.     long                            atomType;                    /* = 'vmhd' */
  299.     SoundMediaInfoHeader            smiHeader;
  300. };
  301. typedef struct SoundMediaInfoHeaderAtom SoundMediaInfoHeaderAtom;
  302.  
  303. struct SoundMediaInfo {
  304.     long                            size;                        /* size of Media info */
  305.     long                            atomType;                    /* = 'minf' */
  306.     SoundMediaInfoHeaderAtom        header;
  307.     HandlerAtom                        dataHandler;
  308.     DataRefAtom                        dataReference;
  309.     SampleTableAtom                    sampleTable;
  310. };
  311. typedef struct SoundMediaInfo SoundMediaInfo;
  312.  
  313. /* whatever data the media handler needs goes after the atomType */
  314. struct MediaInfo {
  315.     long                            size;
  316.     long                            atomType;
  317. };
  318. typedef struct MediaInfo MediaInfo;
  319.  
  320. /***********************
  321. * Media Directory Structures
  322. ***********************/
  323. struct MediaHeader {
  324.     long                            flags;                        /* 1 byte of version / 3 bytes of flags */
  325.     long                            creationTime;                /* seconds since Jan 1904 when directory was created */
  326.     long                            modificationTime;            /* seconds since Jan 1904 when directory was appended */
  327.     TimeValue                        timeScale;                    /* start time for Media (Media time) */
  328.     TimeValue                        duration;                    /* length of Media (Media time) */
  329.     short                            language;
  330.     short                            quality;
  331. };
  332. typedef struct MediaHeader MediaHeader;
  333.  
  334. struct MediaHeaderAtom {
  335.     long                            size;
  336.     long                            atomType;
  337.     MediaHeader                        header;
  338. };
  339. typedef struct MediaHeaderAtom MediaHeaderAtom;
  340.  
  341. struct MediaDirectory {
  342.     long                            size;
  343.     long                            atomType;                    /* = 'mdia' */
  344.     MediaHeaderAtom                    mediaHeader;                /* standard Media information */
  345.     HandlerAtom                        mediaHandler;
  346.     MediaInfo                        mediaInfo;
  347. };
  348. typedef struct MediaDirectory MediaDirectory;
  349.  
  350. /***********************
  351. * Track Structures
  352. ***********************/
  353.  
  354. enum {
  355.     TrackEnable                    = 1 << 0,
  356.     TrackInMovie                = 1 << 1,
  357.     TrackInPreview                = 1 << 2,
  358.     TrackInPoster                = 1 << 3
  359. };
  360.  
  361. struct TrackHeader {
  362.     long                            flags;                        /* 1 byte of version / 3 bytes of flags */
  363.     long                            creationTime;                /* seconds since Jan 1904 when directory was created */
  364.     long                            modificationTime;            /* seconds since Jan 1904 when directory was appended */
  365.     long                            trackID;
  366.     long                            reserved1;
  367.     TimeValue                        duration;                    /* length of track (track time) */
  368.     long                            reserved2;
  369.     long                            reserved3;
  370.     short                            layer;
  371.     short                            alternateGroup;
  372.     short                            volume;
  373.     short                            reserved4;
  374.     MatrixRecord                    matrix;
  375.     Fixed                            trackWidth;
  376.     Fixed                            trackHeight;
  377. };
  378. typedef struct TrackHeader TrackHeader;
  379.  
  380. struct TrackHeaderAtom {
  381.     long                            size;                        /* size of track header */
  382.     long                            atomType;                    /* = 'tkhd' */
  383.     TrackHeader                        header;
  384. };
  385. typedef struct TrackHeaderAtom TrackHeaderAtom;
  386.  
  387. struct EditListType {
  388.     TimeValue                        trackDuration;
  389.     TimeValue                        mediaTime;
  390.     Fixed                            mediaRate;
  391. };
  392. typedef struct EditListType EditListType;
  393.  
  394. struct EditListAtom {
  395.     long                            size;
  396.     long                            atomType;                    /* = elst */
  397.     long                            flags;                        /* 1 byte of version / 3 bytes of flags */
  398.     long                            numEntries;
  399.     EditListType                    editListTable[1];
  400. };
  401. typedef struct EditListAtom EditListAtom;
  402.  
  403. struct EditsAtom {
  404.     long                            size;
  405.     long                            atomType;                    /* = edts */
  406.     EditListAtom                    editList;
  407. };
  408. typedef struct EditsAtom EditsAtom;
  409.  
  410. struct TrackLoadSettings {
  411.     TimeValue                        preloadStartTime;
  412.     TimeValue                        preloadDuration;
  413.     long                            preloadFlags;
  414.     long                            defaultHints;
  415. };
  416. typedef struct TrackLoadSettings TrackLoadSettings;
  417.  
  418. struct TrackLoadSettingsAtom {
  419.     long                            size;
  420.     long                            atomType;                    /* = load */
  421.     TrackLoadSettings                settings;
  422. };
  423. typedef struct TrackLoadSettingsAtom TrackLoadSettingsAtom;
  424.  
  425. struct TrackDirectory {
  426.     long                            size;
  427.     long                            atomType;                    /* = 'trak' */
  428.     TrackHeaderAtom                    trackHeader;                /* standard track information */
  429.     ClippingAtom                    trackClip;
  430.     EditsAtom                        edits;
  431.     MediaDirectory                    media;
  432.     UserDataAtom                    userData;                    /* space for extending with new data types */
  433. };
  434. typedef struct TrackDirectory TrackDirectory;
  435.  
  436. /****************************************
  437. *
  438. *   MovieDirectory -
  439. *        The MovieDirectory is the top level structure which
  440. *        holds the TrackInstance describing where the
  441. *        TrackDirectories are.
  442. *
  443. ****************************************/
  444. struct MovieHeader {
  445.     long                            flags;                        /* 1 byte of version / 3 bytes of flags */
  446.     long                            creationTime;                /* seconds since Jan 1904 when directory was created */
  447.     long                            modificationTime;            /* seconds since Jan 1904 when directory was appended */
  448.     TimeValue                        timeScale;                    /* Time specifications */
  449.     TimeValue                        duration;
  450.     Fixed                            preferredRate;                /* rate at which to play this movie */
  451.     short                            preferredVolume;            /* volume to play movie at */
  452.     short                            reserved1;
  453.     long                            preferredLong1;
  454.     long                            preferredLong2;
  455.     MatrixRecord                    matrix;
  456.     TimeValue                        previewTime;                /* time in track the proxy begins (track time) */
  457.     TimeValue                        previewDuration;            /* how long the proxy lasts (track time) */
  458.     TimeValue                        posterTime;                    /* time in track the proxy begins (track time) */
  459.     TimeValue                        selectionTime;                /* time in track the proxy begins (track time) */
  460.     TimeValue                        selectionDuration;            /* time in track the proxy begins (track time) */
  461.     TimeValue                        currentTime;                /* time in track the proxy begins (track time) */
  462.     long                            nextTrackID;                /* next value to use for a TrackID */
  463. };
  464. typedef struct MovieHeader MovieHeader;
  465.  
  466. struct MovieHeaderAtom {
  467.     long                            size;
  468.     long                            atomType;                    /* = 'mvhd' */
  469.     MovieHeader                        header;
  470. };
  471. typedef struct MovieHeaderAtom MovieHeaderAtom;
  472.  
  473. struct MovieDirectory {
  474.     long                            size;
  475.     long                            atomType;                    /* = 'moov' */
  476.     MovieHeaderAtom                    header;
  477.     ClippingAtom                    movieClip;
  478. /* Track Directories */
  479.     struct {
  480.         TrackDirectory                    trackDirectory;            /* Track directory information */
  481.     }                                track[1];
  482. /* User data for Movie */
  483.     UserDataAtom                    userData;                    /* space for user extensions */
  484. };
  485. typedef struct MovieDirectory MovieDirectory;
  486.  
  487.  
  488. enum {
  489. /* some system defined format IDs */
  490.     MOVIE_TYPE                    = 'moov',
  491.     TRACK_TYPE                    = 'trak',
  492.     MEDIA_TYPE                    = 'mdia',
  493.     VIDEO_TYPE                    = 'vide',
  494.     SOUND_TYPE                    = 'soun'
  495. };
  496.  
  497. /* atom id's */
  498. enum {
  499.     MovieAID                    = 'moov',
  500.     MovieHeaderAID                = 'mvhd',
  501.     ClipAID                        = 'clip',
  502.     RgnClipAID                    = 'crgn',
  503.     MatteAID                    = 'matt',
  504.     MatteCompAID                = 'kmat',
  505.     TrackAID                    = 'trak',
  506.     UserDataAID                    = 'udta',
  507.     TrackHeaderAID                = 'tkhd',
  508.     EditsAID                    = 'edts',
  509.     EditListAID                    = 'elst',
  510.     MediaAID                    = 'mdia',
  511.     MediaHeaderAID                = 'mdhd',
  512.     MediaInfoAID                = 'minf',
  513.     VideoMediaInfoHeaderAID        = 'vmhd',
  514.     SoundMediaInfoHeaderAID        = 'smhd',
  515.     GenericMediaInfoHeaderAID    = 'gmhd',
  516.     GenericMediaInfoAID            = 'gmin',
  517.     DataInfoAID                    = 'dinf',
  518.     DataRefAID                    = 'dref',
  519.     SampleTableAID                = 'stbl',
  520.     STSampleDescAID                = 'stsd',
  521.     STTimeToSampAID                = 'stts',
  522.     STSyncSampleAID                = 'stss',
  523.     STSampleToChunkAID            = 'stsc',
  524.     STShadowSyncAID                = 'stsh',
  525.     HandlerAID                    = 'hdlr',
  526.     STSampleSizeAID                = 'stsz',
  527.     STChunkOffsetAID            = 'stco',
  528.     DataRefContainerAID            = 'drfc',
  529.     TrackReferenceAID            = 'tref',
  530.     ColorTableAID                = 'ctab',
  531.     LoadSettingsAID                = 'load'
  532. };
  533.  
  534.  
  535. #if PRAGMA_IMPORT_SUPPORTED
  536. #pragma import off
  537. #endif
  538.  
  539. #if PRAGMA_ALIGN_SUPPORTED
  540. #pragma options align=reset
  541. #endif
  542.  
  543. #ifdef __cplusplus
  544. }
  545. #endif
  546.  
  547. #endif /* __MOVIESFORMAT__ */
  548.